/*
 * ChargeItemResource.h
 *
 *  Created on: 2013. 9. 11.
 *      Author: mega@gamevil.com
 */

#ifndef CHARGEITEMRESOURCE_H_
#define CHARGEITEMRESOURCE_H_

#include <map>

namespace ProjectZ { namespace NResource {

class ChargeItemData
{
public:
	struct Flyweight
	{
		int _SEQ;
		Toolkit::Str<50> _ITEM_NAME;
		int _ICON;
		int _TID;
		int _SHEET;
		int _CATEGORY;
		int _CLASSTYPE;
		int _POSITION;
		int	_PACKAGE;
		int _QUANTITY;
		int _PRICE;
		int _VC_INDEX;
		int _DISCOUNT;
		Toolkit::Str<1024> _EXPLAIN;
	};

public:
	ChargeItemData() {}
	virtual ~ChargeItemData();

	bool LoadResource(int company, int saleCode);
	Flyweight * GetFly(int seq);

public:
	typedef std::map<int, Flyweight *> CHARGEMAP;
	const int	size(int itemCategory, int classType);

	CHARGEMAP& GetTree() { return clsFlyTree; }

private:
	void	Clear();

private:
	CHARGEMAP clsFlyTree;
};


class ChargeItemResource
{
public:
	ChargeItemResource();
	virtual ~ChargeItemResource();

	bool LoadResource();
	ChargeItemData::Flyweight * GetFly(User * pUser, int seq);
	ChargeItemData * GetDataPtr(User * pUser);

private:
	ChargeItemData * pChargeAD;
	ChargeItemData * pChargeIOS;
};

} /* NResource */ } /* ProjectZ */



#endif /* CHARGEITEMRESOURCE_H_ */
